package com.weifangfirecontrolformal.weifangfirecontrolformal.web.web.systemsetup;

import cn.hutool.json.JSONObject;
import com.weifangfirecontrolformal.weifangfirecontrolformal.common.base.BaseController;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.annotaion.Action;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.annotaion.At;
import com.weifangfirecontrolformal.weifangfirecontrolformal.support.model.RespEntity;
import com.weifangfirecontrolformal.weifangfirecontrolformal.web.service.systemsetup.DepartmentService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.annotation.Resource;

/**
 * 通知公告控制器
 */
@Action
@RequestMapping(value="systemsetup/department")
public class DepartmentController extends BaseController {
    @Resource
    public DepartmentService departmentService;

    /**
     * 部门树形菜单（单位账号登录-系统设置中用）
     * @param
     * @return
     */
    @At(value = "departmentTree", method = RequestMethod.GET)
    public RespEntity departmentTree(@RequestBody(required = false) JSONObject jsonParam) {
        return departmentService.departmentTree(jsonParam);
    }

    /**
     * 部门新增
     * @param
     * @return
     */
    @At(value = "departmentAdd", method = RequestMethod.POST, param = { "name" })
    public RespEntity departmentAdd(@RequestBody(required = false) JSONObject jsonParam) {
        return departmentService.departmentAdd(jsonParam);
    }

    /**
     * 部门修改
     * @param
     * @return
     */
    @At(value = "departmentUpdate", method = RequestMethod.POST, param = { "name","id" })
    public RespEntity departmentUpdate(@RequestBody(required = false) JSONObject jsonParam) {
        return departmentService.departmentUpdate(jsonParam);
    }

    /**
     * 部门删除
     * @param
     * @return
     */
    @At(value = "departmentDelete", method = RequestMethod.POST, param = { "id" })
    public RespEntity departmentDelete(@RequestBody(required = false) JSONObject jsonParam) {
        return departmentService.departmentDelete(jsonParam);
    }

    /**
     * 部门详情
     * @param
     * @return
     */
    @At(value = "departmentDetail", method = RequestMethod.GET, param = { "id" })
    public RespEntity departmentDetail(@RequestBody(required = false) JSONObject jsonParam) {
        return departmentService.departmentDetail(jsonParam);
    }
   
}